package com.okilo.online.app.tools.helper

import android.Manifest
import com.okilo.online.app.OkiloApplication
import com.okilo.online.app.R
import org.json.JSONArray
import org.json.JSONObject

object OkiloPermHp {

    /**
     * sms
     */
    fun gOkiloPermSItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",true)
        item.put("permission", Manifest.permission.READ_SMS)
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_s_title))
        item.put("icon",R.mipmap.okilo_perm_sms_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", OkiloApplication.app.getString(R.string.okilo_perm_s_desc1_title))
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_s_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", OkiloApplication.app.getString(R.string.okilo_perm_s_desc2_title))
        obj2.put("des", OkiloApplication.app.getString(R.string.okilo_perm_s_desc2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", OkiloApplication.app.getString(R.string.okilo_perm_s_desc3_title))
        obj3.put("des", OkiloApplication.app.getString(R.string.okilo_perm_s_desc3))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * phone state
     */
    fun gOkiloPermPSItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", OkiloApplication.app.getString(R.string.okilo_perm_p_title))
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_p_title))
        item.put("icon",R.mipmap.okilo_perm_device_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_p_desc))
        msgArray.put(obj1)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * app list
     */
    fun gOkiloPermALItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission",OkiloApplication.app.getString(R.string.okilo_perm_l_title))
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_l_title))
        item.put("icon",R.mipmap.okilo_perm_app_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", OkiloApplication.app.getString(R.string.okilo_perm_l_desc1_title))
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_l_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", OkiloApplication.app.getString(R.string.okilo_perm_l_desc2_title))
        obj2.put("des", OkiloApplication.app.getString(R.string.okilo_perm_l_desc2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title",  OkiloApplication.app.getString(R.string.okilo_perm_l_desc3_title))
        obj3.put("des", OkiloApplication.app.getString(R.string.okilo_perm_l_desc2))
        msgArray.put(obj3)

        item.put("msgList",msgArray)
        return item
    }

    /**
     * camera
     */
    fun gOkiloPermCItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",true)
        item.put("permission", Manifest.permission.CAMERA)
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_c_title))
        item.put("icon",R.mipmap.okilo_perm_camera_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_c_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", OkiloApplication.app.getString(R.string.okilo_perm_c_desc2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", "")
        obj3.put("des", OkiloApplication.app.getString(R.string.okilo_perm_c_desc3))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * album
     */
    fun gOkiloPermABItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", OkiloApplication.app.getString(R.string.okilo_perm_pa_title))
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_pa_title))
        item.put("icon",R.mipmap.okilo_perm_photo_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_pa_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", OkiloApplication.app.getString(R.string.okilo_perm_pa_desc2))
        msgArray.put(obj2)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * address book
     */
    fun gOkiloPermADBItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", OkiloApplication.app.getString(R.string.okilo_perm_ab_title))
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_ab_title))
        item.put("icon",R.mipmap.okilo_perm_contact_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_ab_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", OkiloApplication.app.getString(R.string.okilo_perm_ab_desc2))
        msgArray.put(obj2)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * storage
     */
    fun gOkiloPermSTItem(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", OkiloApplication.app.getString(R.string.okilo_perm_st_title))
        item.put("title", OkiloApplication.app.getString(R.string.okilo_perm_st_title))
        item.put("icon",R.mipmap.okilo_perm_storage_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", OkiloApplication.app.getString(R.string.okilo_perm_st_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", OkiloApplication.app.getString(R.string.okilo_perm_st_desc2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", "")
        obj3.put("des", OkiloApplication.app.getString(R.string.okilo_perm_st_desc3))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }
}